using System.Data;
using ET;
namespace DAL
{
    public class Province_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdProvince(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Province_Search");
        }
        public DataTable BindGirdProvinceDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_ID", id);
            return cls.GetData("sp_tb_Province_Detail");
        }
        public DataTable BindGirdProvinceDomain(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Domain_ID", id);
            return cls.GetData("sp_tb_Province_Domain");
        }
        public static DataTable GetProvinceFillter(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Domain_Id", id);
            return cls.GetData("sp_tb_Province_Fillter");
        }
        #endregion

        #region Insert
        public bool InsertProvince(Province_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Domain_Id", data.Domain_Id);
            cls.AddParameter("@Province_Alias", data.Province_Alias);
            cls.AddParameter("@Province_Name", data.Province_Name);
            cls.AddParameter("@Province_Note", data.Province_Note);
            return cls.ExecuteNonQuery("sp_tb_Province_Insert");
        }
        #endregion

        #region Update
        public bool UpdateProvince(Province_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_Id", data.Province_Id);
            cls.AddParameter("@Domain_Id", data.Domain_Id);
            cls.AddParameter("@Province_Alias", data.Province_Alias);
            cls.AddParameter("@Province_Name", data.Province_Name);
            cls.AddParameter("@Province_Note", data.Province_Note);
            return cls.ExecuteNonQuery("sp_tb_Province_Update");
        }
        #endregion

        #region Delete
        public bool DeleteProvince(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_Id", id);
            cls.ExecuteNonQuery("sp_tb_Province_Delete");
            return true;
        }
        #endregion
    }
}